#include <iostream>
#include <queue>
#include <cmath>

using namespace std;
typedef long long LL;
priority_queue<LL> heap;
const int N = 1e5 + 10;
LL a[N];
LL f[N];
LL n, m;
int check(int x)
{
    int cnt = 0;
    for (int i = 1; i <= n; i++)
    {
        int t = f[i];
        while (t > x)
        {
            cnt++;
            t = ceil(1.0 * t / 2);
        }
    }
    return cnt;
}
int main()
{
    cin >> n >> m;
    m++;
    LL l = 0, r = 0;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        f[i] = (a[i] - a[i - 1]);
        r = max(r, f[i]);
    }
    while (l < r)
    {
        int mid = (l + r) / 2;
        if (check(mid) > m)l = mid + 1;
        else  r = mid;
    }
    cout << l << endl;
    return 0;
}